<?php

namespace app\api\validate;

use think\Validate;

class User extends Validate
{
    protected $rule =   [
        'qq|QQ'  => 'require|min:5|max:11|number',
        'password|密码'   => 'require|min:5|max:11|alphaNum',
        'signature|签名' => 'max:30',
        'nickname|昵称' => 'unique:user,nickname'
    ];
    protected $message  =   [];
    protected $scene = [
        'login' => ['qq', 'password'],
        'register' => ['qq', 'password'],
        'account' => ['signature', 'nickname']
    ];
    public function sceneRegister()
    {
        return $this
            ->append('qq', 'unique:user,qq');
    }
}
